Parallel processing database system

ABSTRACT

A method and system for executing database queries in parallel using a shared metadata store. The metadata store may reside on a master node, where the master node is the root node in a tree. The master node may distribute query plans and query metadata to other nodes in the cluster. These additional nodes may request additional metadata from each other or the master nodes as necessary.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of co-pending U.S. patent applicationSer. No. 15/714,637, entitled PARALLEL PROCESSING DATABASE SYSTEM filedSep. 25, 2017 which is incorporated herein by reference for allpurposes, which is a continuation of U.S. patent application Ser. No.13/839,390, entitled PARALLEL PROCESSING DATABASE SYSTEM filed Mar. 15,2013, now U.S. Pat. No. 9,805,092, which is incorporated herein byreference for all purposes, which claims priority to U.S. ProvisionalApplication No. 61/769,043, entitled INTEGRATION OF MASSIVELY PARALLELPROCESSING WITH A DATA INTENSIVE SOFTWARE FRAMEWORK filed Feb. 25, 2013which is incorporated herein by reference for all purposes.

FIELD OF THE INVENTION

This invention relates generally to parallel processing databases, andmore particularly to systems and methods for using a shared metadatacatalog.

BACKGROUND OF THE INVENTION

Database systems are used to house digital information for a variety ofapplications and users. These systems may house thousands of terabytesor petabytes of information, all of which may need to be quicklysearched and analyzed at a user's request. Occasionally, these searchand analysis requests may be computationally intensive for a singlemachine, and the query tasks may be distributed among multiple nodes ina cluster

Massively parallel processing (“MPP”) databases may be used to executecomplex database queries in parallel by distributing the queries tonodes in a cluster. Each node may receive a portion of the query andexecute it using a local metadata store. Occasionally, data may bereplicated between the nodes in a cluster, thereby reducing consistencyand increasing maintenance costs.

There is a need, therefore, for an improved method, article ofmanufacture, and apparatus for performing queries on a distributeddatabase system.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention will be readily understood by the followingdetailed description in conjunction with the accompanying drawings,wherein like reference numerals designate like structural elements, andin which:

FIG. 1 illustrates a parallel processing database architecture inaccordance with some embodiments of the present disclosure.

FIG. 2 illustrates a parallel processing database have a shared metadatacatalog in accordance with some embodiments of the present invention.

FIG. 3 is a flowchart of a method for executing a query using a sharedmetadata catalog in accordance with some embodiments of the presentinvention.

FIG. 4 illustrates a flowchart of a method for executing a query inparallel on a parallel processing database using a shared metadatacatalog in accordance with some embodiments of the present invention.

FIG. 5 illustrates a system architecture for locating execution metadatausing a tree structure in accordance with some embodiments of thepresent invention.

FIG. 6 illustrates a flowchart of a method for locating executionmetadata using a tree structure in accordance with some embodiments ofthe present invention.

DETAILED DESCRIPTION

A detailed description of one or more embodiments of the invention isprovided below along with accompanying figures that illustrate theprinciples of the invention. While the invention is described inconjunction with such embodiment(s), it should be understood that theinvention is not limited to any one embodiment. On the contrary, thescope of the invention is limited only by the claims and the inventionencompasses numerous alternatives, modifications, and equivalents. Forthe purpose of example, numerous specific details are set forth in thefollowing description in order to provide a thorough understanding ofthe present invention. These details are provided for the purpose ofexample, and the present invention may be practiced according to theclaims without some or all of these specific details. For the purpose ofclarity, technical material that is known in the technical fieldsrelated to the invention has not been described in detail so that thepresent invention is not unnecessarily obscured.

It should be appreciated that the present invention can be implementedin numerous ways, including as a process, an apparatus, a system, adevice, a method, or a computer readable medium such as a computerreadable storage medium or a computer network wherein computer programinstructions are sent over optical or electronic communication links.Applications may take the form of software executing on a generalpurpose computer or be hardwired or hard coded in hardware. In thisspecification, these implementations, or any other form that theinvention may take, may be referred to as techniques. In general, theorder of the steps of disclosed processes may be altered within thescope of the invention.

An embodiment of the invention will be described with reference to adata storage system in the form of a storage system configured to storefiles, but it should be understood that the principles of the inventionare not limited to this configuration. Rather, they are applicable toany system capable of storing and handling various types of objects, inanalog, digital, or other form. Although terms such as document, file,object, etc. may be used by way of example, the principles of theinvention are not limited to any particular form of representing andstoring data or other information; rather, they are equally applicableto any object capable of representing information.

With reference to FIG. 1, a parallel processing database architectureconsistent with an embodiment of the present disclosure is discussed.Client 100 may submit a query, such as an SQL database query, to masternode 102. Master node 102 may comprise processor 104 and non-transitorycomputer readable medium 106. Master node 102 may derive one or morequery plans based on the query received from client 100, and thereaftertransmit the query plans to worker nodes 108. A query plan may be, forexample, a set of instructions for performing a data operation on adatabase. In an embodiment, worker nodes 108 may include processors 112and non-transitory computer readable storage mediums 114. Worker nodes108 may process the query plans in parallel, and then return theirresults to master node 102. Master node 102 may compile all the receivedresults, and return a final query result to client 100.

In some embodiments, worker nodes may need query metadata to execute thereceived query plans. Query metadata may include, for example, databasetable definitions, user or system defined database functions, databaseviews, and/or database indexes. In some embodiments, this metadata maybe maintained by catalogs on every worker node in the system. Forexample, these catalogs may be stored in non-transitory computerreadable mediums 114.

While maintaining the catalogs on every node may be manageable onsmaller systems, such as system with one or two machines, suchmaintenance may not be scalable as the database cluster grows. Forexample, if a database cluster comprises ten thousand nodes, and if eachnode contains a local metadata catalog, maintaining those catalogs maybe unwieldy or impossible. Even a minor change may need to be replicatedamong the ten thousand different nodes, and each replication presents arisk of error. As the cluster size grows, this risk increases. Further,storing the catalog on every node in the system may not be an efficientuse of storage resources. Even if the catalog only consumes a smallamount of storage space, this storage space may be significant whenaggregated over thousands of nodes.

In order to address these challenges, a database system may use themaster node/worker node architecture shown in FIG. 2. Client 200 maysubmit a query, such as an SQL query, to master node 202. Master node202 may develop a query plan from the query, and forward that plan toworker node 204 for execution. In an embodiment, client 200 may besimilar to client 100, master node 202 may be similar to master node102, and worker node 204 may be substantially similar to worker nodes108. While only one worker node is shown in FIG. 2, any number of nodesmay be used in the database cluster.

The query from client 200 may be received by query dispatcher 206. In anembodiment, query dispatcher 206 develops query plans from the receivedquery. Query dispatcher may also determine what metadata may benecessary for the execution of the query plans, and retrieve thatmetadata from database catalog server 208 (the “metadata catalog” or“database catalog”). This metadata may be identified while interpretingthe received query and developing the query plans. In an embodiment, thedatabase catalog may be stored on a non-transitory computer readablemedium, such as storage 210. Query dispatcher may then transmit both theretrieved metadata and the query plan to worker node 204.

Transmitting the metadata data along with the query plan from masternode 202 allows the database catalog to be maintained at a singlelocation; namely, master node 202. Since worker node 204 receives thequery plan along with the metadata, it does not need to maintain a localmetadata catalog. When a change is made to the catalog, it may be made asingle location and may not need to be propagated to other nodes in thecluster. This may decrease maintenance costs, improve reliability,increase the amount of available space in the cluster, and improvescalability.

In an embodiment, the query plan is annotated to include the metadata,and the plan and metadata are transmitted at the same time. Additionallyor alternatively, the query plan and metadata may be transmittedseparately. For example, the metadata may be transmitted to worker node204 before or after the query plan.

Once worker node 204 has received the plan and the metadata, queryexecuter 212 may execute the query plan. In some embodiments, thisexecution may involve a performing a data operation on data 214. Data214 may be stored on a computer readable medium, such as medium 114. Insome embodiments, the metadata received from master node 202 may not besufficient to fully execute the query plan. Should query executor 212need additional metadata, it may send a request back to database catalogserver 208. Catalog server 208 may retrieve the additional metadata,transmit it back to query executor 212, and the query executor maycomplete the query.

In an embodiment, a separate catalog server session is established foreach query request. For example, when a request is received a catalogserver session may be initiated, where that server session includes asnapshot of the metadata catalog. In an embodiment, this snapshot istaken when the query is executed. The metadata initially transmitted tothe worker nodes may be retrieved from that session, and any incomingrequest for additional metadata may retrieve the additional metadatafrom the same session. This may ensure that the metadata remainsconsistent throughout query execution. For example, if a session is notused, the query dispatcher may distribute query plans with the metadata,the metadata may then change on the database catalog server or computerreadable medium, and a worker node may make a request for additionalmetadata. In response, the catalog server may distribute the modifiedmetadata which is not consistent with the original query. Initiatingseparate catalog server processes may alleviate this problem.

Turning now to FIG. 3, a method for executing a query on a systemsubstantially similar to FIG. 2 is discussed. At 300, a query isreceived at a master node. This query could be received, for example,from client 100. The master node may comprise a database catalog whichincludes metadata defining database objects. This database catalog maybe managed by database catalog server 208, and stored on storage 210. Inan embodiment, the metadata may include database table definitions, useror system defined database functions, database views, and/or databaseindexes.

At 302, a query plan and query metadata are transmitted to a worker nodefor execution. The query plan may be based on the received query, andmay comprise an execution strategy for completing all or a portion ofthe query. The query metadata may include metadata needed for executingthe query plan. For example, if the query plan involves a user definedfunction, that function may be included in the transmitted metadata.

At 304, the metadata may be stored a local cache on the worker node.This cache could exist, for example, in a memory such as random accessmemory (“RAM”). Storing the metadata in cache allows for rapid retrievalduring the execution process and reduces the number of call backs fromthe worker node to the metadata catalog on the master node.

At block 306, the query plan is executed on the worker node. The queryexecution may require use of metadata, and that metadata may beretrieved from the worker cache.

At 308, the worker may determine that it needs additional metadata toexecute the query, and may transmit a request for that metadata back tothe master node. In some embodiments, this transmission may be receivedby a catalog server, such as metadata catalog server 208. Additionallyor alternatively, the transmission may be received and processed by acatalog server session as discussed above.

At 310, the additional requested metadata may be transmitted from themaster to the worker, and the query execution may continue. At block312, once the execution is complete, the cache may be cleared and thequery result may be returned to the master node.

FIG. 4 depicts a method similar to FIG. 3 for executing query plans inparallel on a database cluster. At 400 a query is received at a masternode, where the master node comprises a metadata catalog. The catalogmay include metadata defining database objects, as discussed above.

At block 402, the master node may generate a plurality of query plans.These plans could be generated, for example, using query dispatcher 206.At 404, these plans may be distributed to a plurality of worker nodes inthe database cluster, and at 406 the plans may be executed.

Turning now to FIG. 5, a system for locating query metadata is shown. Aspreviously discussed, a worker node may transmit a request to the masternode when the worker does not have all the necessary metadata forexecuting a query plan. When there are only a few nodes in the cluster,this may be an efficient way of obtaining the missing metadata. As thecluster size increases, however, this approach may become more costly.For example, if there are ten thousand nodes in a cluster, additionalmetadata may be requested from up to ten thousand locations. The systemmay not have sufficient bandwidth, and the master node may not haveenough processing resources, to handle this number of consecutiveconnections.

The architecture shown in FIG. 5 may help overcome these issues. Workernodes 504, 505, 506, 508, and 510 may be configured in a tree structure,and master node 502 may be a root node. Master node 502 may receive aquery from client 500, may develop query plans for that query, and maydistribute the query plans and needed metadata to the worker nodes. Thisprocess may be substantially similar to the processes discussed above.In an embodiment, master node 502 may distribute the query plans andmetadata directly to each worker node. In other words, master node 502has a connection to each worker node and may transmit the query plansand metadata without using the shown tree structure.

Once a worker node has received a query plan and some associatedmetadata, that node may begin processing the plan. In an embodiment, aworker node may need additional metadata that was not included in theoriginal transmission from the master node. As discussed above, workernode may send a request to a master node for the additional metadata.This may, however, result in an unmanageable number of connections tothe master node if multiple worker nodes make similar requests.

In some embodiments, rather than transmitting a request directly to themaster node, the worker node may request additional metadata from aparent in the tree structure. Since the master node distributes metadatato all the nodes in the cluster, a parent of the present worker node mayhave the additional metadata stored in cache. If the immediate parentdoes not have the additional metadata, the successive parents may bequeried until the metadata is found or the master node is reached. Oncethe additional metadata is found, whether on an ancestor or the masternode, it may be transmitted back to the requesting worker node. This mayallow a very large number of nodes in a cluster to request additionalmetadata, without opening an unmanageable number of connections to themaster node.

For example, master node 502 may transmit a query plan and some metadatato worker node 505. Worker node 505 may determine that additionalmetadata is necessary to execute the query plan. Rather than requestingthe additional metadata directly from master node 502 (which containsthe metadata catalog), worker node 505 may request the metadata from itsparent worker node 508. Worker node 508 may check its cache and returnthe additional metadata to node 505 if the metadata is found. If theadditional metadata is not found, worker node 508 may forward therequest to the next parent, which is master node 502. Master node 502may retrieve the additional metadata from the metadata catalog andtransmit it to the original requesting worker node 505.

In some embodiments, requests for additional metadata may be forwardedup the tree structure as just described. Each node may know its parent,and if the metadata is not found in the local cache the node may forwardthe request to that parent. The tree structure may be particularlybeneficial because new nodes can be added or removed without updatinginformation on every node in the cluster. In some embodiments, however,each worker node may be responsible for maintaining its own ancestry.For example, worker node 505 may know its parents are worker node 508and master node 502. If a request for additional metadata is sent toworker node 508 and the metadata is not found, worker node 505 maysubmit the request to master node 502 directly rather than having therequest forwarded by worker node 508.

Additionally or alternatively, no tree structure may be used. Eachworker node may maintain a list or directory of other worker nodes. Ifadditional metadata is needed, the worker node may iterate through thislist and make calls to the other worker nodes. The master node may onlybe called once the list is exhausted without locating the additionalmetadata. The requests may be sent to the nodes on the list one at atime, or a request may be sent to all the nodes at the same time.

In some embodiments, requests for additional metadata may be transmittedthroughout the system as a multicast request. In such an embodiment, arequest may only be made to the master node if no other node respondswithin a defined time frame.

Turning now to FIG. 6, a method for locating additional metadata using atree structure is discussed. At block 600, a query is received at amaster node. The master node may comprise a database catalog thatincludes metadata defining database objects. The master node may be theroot node in a tree structure, and in an embodiment may be substantiallysimilar to master node 502.

At 602 a plurality of query plans may be derived from the query, and at604 these plans may be distributed to a plurality of worker nodes. In anembodiment, the worker nodes may be similar to worker nodes 504, 505,506, 508, and 510. Query metadata may be distributed with the plans,where the query metadata includes metadata necessary for executing theplans.

At 606, one or more of the worker nodes may determine they needadditional metadata to execute the query plan, and at 608 this workernode may query a parent for the additional metadata. In an embodiment,this parent node may be another worker node, and may comprise a metadatacache. This metadata cache may be substantially similar to the cachediscussed in reference to FIG. 3.

At 610, the cache on the parent node is checked for the metadata. If themetadata is found, it may be transmitted to the worker node making therequest. If the metadata is not found, successive ancestor nodes may bequeried at 612 until the additional metadata is found in a parent workernode's cache, or the master node is reached.

For the sake of clarity, the processes and methods herein have beenillustrated with a specific flow, but it should be understood that othersequences may be possible and that some may be performed in parallel,without departing from the spirit of the invention. Additionally, stepsmay be subdivided or combined. As disclosed herein, software written inaccordance with the present invention may be stored in some form ofcomputer-readable medium, such as memory or CD-ROM, or transmitted overa network, and executed by a processor.

All references cited herein are intended to be incorporated byreference. Although the present invention has been described above interms of specific embodiments, it is anticipated that alterations andmodifications to this invention will no doubt become apparent to thoseskilled in the art and may be practiced within the scope and equivalentsof the appended claims. More than one computer may be used, such as byusing multiple computers in a parallel or load-sharing arrangement ordistributing tasks across multiple computers such that, as a whole, theyperform the functions of the components identified herein; i.e. theytake the place of a single computer. Various functions described abovemay be performed by a single process or groups of processes, on a singlecomputer or distributed over several computers. Processes may invokeother processes to handle certain tasks. A single storage device may beused, or several may be used to take the place of a single storagedevice. The disclosed embodiments are illustrative and not restrictive,and the invention is not to be limited to the details given herein.There are many alternative ways of implementing the invention. It istherefore intended that the disclosure and following claims beinterpreted as covering all such alterations and modifications as fallwithin the true spirit and scope of the invention.

What is claimed is:
 1. A parallel processing database system,comprising: a database catalog associated with a master node, thedatabase catalog comprising metadata defining database objects; themaster node, wherein the master node comprises one or more processors,and the master node is configured to receive a query from a client node,to obtain metadata from the database catalog using a catalog serversession that is established in connection with the query, to send one ormore query plans and corresponding metadata to one or more of aplurality of worker nodes; and the plurality of worker nodes incommunication with the master node, wherein one or more of the pluralityof worker nodes are configured to use the corresponding query metadatareceived from the master node in connection with execution of the one ormore query plans, and a first worker node of the one or more of theplurality of worker nodes determines that the received correspondingquery metadata is not sufficient to execute the corresponding queryplan, and in response to determining that the received correspondingquery metadata is not sufficient to execute the corresponding query planrequests additional metadata from one or more other worker nodes of theplurality of worker nodes.
 2. The system of claim 1, wherein the masternode is further configured to receive a request from a first worker nodeof the one or more of the plurality of worker nodes, the request beingfor additional metadata to be used in connection with execution of thecorresponding query plan, and the master node is further configured toobtain the additional metadata in response to receiving the request forthe additional metadata.
 3. The system of claim 2, wherein the requestfor additional metadata is received from a first worker node in responseto the first worker node determines that received corresponding querymetadata is not sufficient to execute the corresponding query plan, andin response to a determination that at least one other worker node ofthe plurality of worker nodes is queried for the additional metadata andthe at least one other worker node does not have the additionalmetadata.
 4. The system of claim 1, wherein individual nodes of theplurality of worker nodes include a cache.
 5. The system of claim 4,wherein the received query metadata is stored in the cache of theindividual nodes.
 6. The system of claim 1, wherein the master node andthe plurality of worker nodes have a tree configuration. The system ofclaim 6, wherein the master node is a root node.
 8. The system of claim1, wherein an individual node of the plurality of worker nodes requestsadditional metadata from the master node.
 9. The system of claim 1,wherein an individual node of the plurality of worker nodes requestsadditional metadata from a parent node.
 10. The system of claim 9,wherein the parent node is another worker node.
 11. The system of claim1, wherein the database objects comprise database table definitions,database functions, database users, database views, and databaseindexes.
 12. The system of claim 1, wherein the master node receives thequery from the client, develops the one or more query plans based atleast in part on the query, and communicates each of the one or morequery plans to a corresponding one of the plurality of worker nodes inconnection with metadata from the database catalog that is determined tobe required for execution of the query plan.
 13. The system of claim 1,wherein in response to receiving the query, the catalog server sessionis established, and the corresponding query metadata is retrieved in thecatalog server session.
 14. The system of claim 13, wherein in responseto a determination that a first worker node requests additional querymetadata to be used in connection with the execution of thecorresponding query plan, the additional query metadata is retrievedusing the catalog server session that was established in connection withthe received query.
 15. The system of claim 1, wherein in response to adetermination that metadata stored in the database catalog is updated ata time between when metadata to be sent in connection with the one ormore query plans is obtained from the database catalog and when therequest for additional metadata is received by the master node, theadditional metadata is obtained from the database catalog using thecatalog server session that was established in connection with the querysuch that the additional metadata does not include the updated metadata.16. The system of claim 1, wherein the master node is queried for theadditional metadata after the one or more other of the plurality ofworker nodes are requested for the additional metadata.
 17. The systemof claim 1, wherein the master node and the plurality of worker nodeshave a tree configuration, and the one or more other of the plurality ofworker nodes are queried for additional metadata based at least in parton the tree configuration.
 18. A method comprising: receiving, by amaster node, a query from a client node, wherein the master node isassociated with at least one processor configured to communicate with adatabase catalog that includes metadata defining database objects, andwherein the master node is in communication with a plurality of workernodes; obtaining, by the master node, metadata from the database catalogusing a catalog server session that is established in connection withthe query; and sending, by the master node, a corresponding query planand corresponding query metadata to one or more of the plurality ofworker nodes, wherein the one or more of the plurality of worker nodesare configured to use the corresponding query metadata received from themaster node in connection with execution of the corresponding queryplan, a first worker node of the one or more of the plurality of workernodes determines that the received corresponding query metadata is notsufficient to execute the corresponding query plan, and in response todetermining that the received corresponding query metadata is notsufficient to execute the corresponding query plan requests additionalmetadata from one or more other worker nodes of the plurality of workernodes.
 19. A computer program product embodied in a tangiblenon-transitory computer-readable storage medium and comprising computerinstructions for: receiving, by a master node, a query from a clientnode, wherein the master node is associated with a database catalog thatincludes metadata defining database objects, and wherein the master nodeis in communication with a plurality of worker nodes; obtaining, by themaster node, metadata from the database catalog using a catalog serversession that is established in connection with the query; and sending,by the master node, a corresponding query plan and corresponding querymetadata to one or more of the plurality of worker nodes, wherein theone or more of the plurality of worker nodes are configured to use thecorresponding query metadata received from the master node in connectionwith execution of the corresponding query plan, a first worker node ofthe one or more of the plurality of worker nodes determines that thereceived corresponding query metadata is not sufficient to execute thecorresponding query plan, and in response to determining that thereceived corresponding query metadata is not sufficient to execute thecorresponding query plan requests additional metadata from one or moreother worker nodes of the plurality of worker nodes.